<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = new Array(5);
        //定义总分变量
        var num = 0;
        //定义最高分变量
        var max = 0;
        //定义最低分变量
        var min = 100;
        //定义变量r，用于记录输入的分数
        var r;
        for (let i = 0; i < arr.length; i++) {
            r = prompt("请输入你的成绩");
            //将r转为浮点型
            r =  parseFloat(r);
            //求分数的最大值
            if (max < r) {
                max = r;
            }
            //求分数的最小值
            if (min > r) {
                min = r;
            }
            //将输入的成绩放入数组中
            arr[i] = r;
            num = num + arr[i];
        }
        var average = (num / 5).toFixed(2);
        document.write("五门成绩分别是：");

        for (let i = 0; i < arr.length; i++) {
            const element = arr[i];
            if (i < arr.length - 1) {
                document.write(element + ",");
            }else {
                document.write(element);
            }
        }
        
        document.write("<br>");
        document.write("总分是：" + num + "<br>");
        document.write("平均分是：" + average + "<br>");
        document.write("最高分是：" + max + "<br>");
        document.write("最低分是：" + min + "<br>");
    </script>
</body>
</html>